/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelServer.java
 *
 * Created on 25/08/2011, 22:15:23
 */
package tsb.UI.Paneles;

import tsb.UI.Paneles.PC.PanelModemPC;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import tsb.UI.Paneles.PC.PanelFastEthernetFibra;
import tsb.UI.Paneles.PC.PanelEthernet;
import tsb.UI.Paneles.PC.PanelGigabitFibra;
import tsb.UI.Paneles.PC.PanelGigabitRJ45;
import tsb.UI.Paneles.PC.PanelFastEthernetRJ45;
import tsb.dominio.interfaces.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import tsb.UI.Ventanas.VentanaDeError;
import tsb.dominio.enumeraciones.AsignacionIP;

/**
 *
 * @author Fede
 */
public class PanelServer extends javax.swing.JPanel {
    
    private boolean pestaña1=false; // para saber si la pestaña ya tiene un panel
    private boolean pestaña2=false; // para saber si la pestaña ya tiene un panel
    private boolean pestaña3=false; // para saber si la pestaña ya tiene un panel
    private ArrayList<InterfaceDeConeccion> listaInterfaces;
     //para las imagenes del combobox Encendido
    ImageIcon[] images;
    String[] opciones = {"Si","No"};
    Integer[] intArray;
    /** Creates new form PanelServer */
    public PanelServer()
    {
        images = new ImageIcon[opciones.length];
        intArray = new Integer[opciones.length];
        for (int i = 0; i < opciones.length; i++) {
            intArray[i] = new Integer(i);
            if(i==0)
            {images[i] = new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/PRENDIDO_16X16.png"));
            }
            else
            {images[i] = new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/APAGADO_16X16.png"));
            }
            if (images[i] != null) {
                images[i].setDescription(opciones[i]);
            }
        }
        initComponents();
        ComboBoxRenderer renderer= new ComboBoxRenderer();
        renderer.setPreferredSize(new Dimension(10, 20));
        this.cmbencendido.setRenderer(renderer);

        this.btnQuitarInterfazPestaña1.setVisible(false);
        this.btnQuitarInterfazPestaña2.setVisible(false);
        
        listaInterfaces = new ArrayList<InterfaceDeConeccion>();
    }
    public boolean getPestaña1()
    {
        return pestaña1;
    }
    public void setPestaña1(boolean pestaña1)
    {
        this.pestaña1=pestaña1;
    }
    public boolean getPestaña2()
    {
        return pestaña2;
    }
    public void setPestaña2(boolean pestaña2)
    {
        this.pestaña2=pestaña2;
    }
    public boolean getPestaña3()
    {
        return pestaña3;
    }
    public void setPestaña3(boolean pestaña3)
    {
        this.pestaña3=pestaña3;
    }
    public boolean getDhcpOStatic()
    {
        if (this.rbtDCHP.isSelected())
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public boolean existeGateway()
    {
        if(this.txtGateway.getText().compareTo("")==0)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    public boolean existeDns()
    {
        if(this.txtServidorDNS.getText().compareTo("")==0)
        {
            return false;
        }
        else
        {
            return true;
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btgrEncendido = new javax.swing.ButtonGroup();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        rbgrpAsignacionIP = new javax.swing.ButtonGroup();
        rbgrENcendidoHTTP = new javax.swing.ButtonGroup();
        rbgrENcendidoDHCP = new javax.swing.ButtonGroup();
        rbgrENcendidoTFTP = new javax.swing.ButtonGroup();
        rbgrENcendidoDNS = new javax.swing.ButtonGroup();
        PestañasConfiguraciones = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        txtNombreAMostrar = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        cmbencendido = new javax.swing.JComboBox(intArray);
        jLabel1 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtGateway = new javax.swing.JTextField();
        txtServidorDNS = new javax.swing.JTextField();
        rbtDCHP = new javax.swing.JRadioButton();
        rbtStatic = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        cmbIntefaces = new javax.swing.JComboBox();
        btnAgregar = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        pestañasInterfaces = new javax.swing.JTabbedPane();
        panelPestaña1 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña1 = new javax.swing.JButton();
        panelPestaña2 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña2 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel8 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jSeparator1 = new javax.swing.JSeparator();
        jPanel4 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jLabel11 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel12 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jRadioButton5 = new javax.swing.JRadioButton();
        jRadioButton6 = new javax.swing.JRadioButton();
        jSeparator3 = new javax.swing.JSeparator();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jPanel7 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jRadioButton7 = new javax.swing.JRadioButton();
        jSeparator4 = new javax.swing.JSeparator();
        jRadioButton8 = new javax.swing.JRadioButton();
        jLabel20 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(jTable2);

        setBackground(new java.awt.Color(255, 255, 255));

        PestañasConfiguraciones.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        txtNombreAMostrar.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel2.setText("Nombre a Mostrar:");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel1.setText("Encendido:");

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Gateway/DNS"));

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel4.setText("Forma de Asignacion IP:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel3.setText("Gateway:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel5.setText("Servidor DNS:");

        txtGateway.setEnabled(false);

        txtServidorDNS.setEnabled(false);

        rbtDCHP.setBackground(new java.awt.Color(255, 255, 255));
        rbgrpAsignacionIP.add(rbtDCHP);
        rbtDCHP.setFont(new java.awt.Font("Tahoma", 0, 14));
        rbtDCHP.setSelected(true);
        rbtDCHP.setText("DHCP");
        rbtDCHP.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                rbtDCHPMouseClicked(evt);
            }
        });

        rbtStatic.setBackground(new java.awt.Color(255, 255, 255));
        rbgrpAsignacionIP.add(rbtStatic);
        rbtStatic.setFont(new java.awt.Font("Tahoma", 0, 14));
        rbtStatic.setText("Static");
        rbtStatic.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                rbtStaticMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rbtStatic)
                            .addComponent(rbtDCHP)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtServidorDNS)
                            .addComponent(txtGateway, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)))))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(rbtDCHP))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbtStatic)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtGateway, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtServidorDNS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtNombreAMostrar, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE))
                            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(100, 100, 100))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(119, 119, 119)
                                .addComponent(cmbencendido, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(222, Short.MAX_VALUE))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtNombreAMostrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(cmbencendido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(184, Short.MAX_VALUE))
        );

        PestañasConfiguraciones.addTab("Configuraciones", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/CONFIGURACIONES2_16X16.png")), jPanel1); // NOI18N

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));

        cmbIntefaces.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ethernet", "Fast Ethernet RJ45", "Fast Ethernet Fibra Optica", "Gigabit RJ45", "Gigabit Fibra Optica", "Modem", "Serial", "Wireless" }));

        btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/add16x16.png"))); // NOI18N
        btnAgregar.setText("Agregar");
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel6.setText("Interfaces de Conección");

        panelPestaña1.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña1.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestaña1Layout = new javax.swing.GroupLayout(panelPestaña1);
        panelPestaña1.setLayout(panelPestaña1Layout);
        panelPestaña1Layout.setHorizontalGroup(
            panelPestaña1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestaña1Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña1))
        );
        panelPestaña1Layout.setVerticalGroup(
            panelPestaña1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestaña1Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña1))
        );

        pestañasInterfaces.addTab("Interfaz 1", panelPestaña1);

        panelPestaña2.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña2.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestaña2Layout = new javax.swing.GroupLayout(panelPestaña2);
        panelPestaña2.setLayout(panelPestaña2Layout);
        panelPestaña2Layout.setHorizontalGroup(
            panelPestaña2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestaña2Layout.createSequentialGroup()
                .addContainerGap(293, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña2))
        );
        panelPestaña2Layout.setVerticalGroup(
            panelPestaña2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestaña2Layout.createSequentialGroup()
                .addContainerGap(331, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña2))
        );

        pestañasInterfaces.addTab("Interfaz 2", panelPestaña2);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(cmbIntefaces, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAgregar))
                    .addComponent(jLabel6)
                    .addComponent(pestañasInterfaces, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbIntefaces, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAgregar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(pestañasInterfaces, javax.swing.GroupLayout.PREFERRED_SIZE, 382, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        PestañasConfiguraciones.addTab("Interfaces", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/CONEXIONES_16X16.png")), jPanel2); // NOI18N

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));

        jPanel8.setBackground(new java.awt.Color(255, 255, 255));

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel7.setText("HTTP");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel8.setText("Encendido:");

        jRadioButton1.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoHTTP.add(jRadioButton1);
        jRadioButton1.setSelected(true);
        jRadioButton1.setText("Si");

        jRadioButton2.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoHTTP.add(jRadioButton2);
        jRadioButton2.setText("No");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel9.setText("Pagina por defecto (index.html)");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("<html>\n<center><font size='+2' color='blue'>Packet Tracer 5.0</font></center>\n<hr>Bienvenido al Simulador de Redes\n</html>");
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(154, 154, 154)
                        .addComponent(jLabel7))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton2)
                            .addComponent(jRadioButton1)))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel9))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jRadioButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton2)
                .addGap(8, 8, 8)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("HTTP", jPanel8);

        jPanel4.setBackground(new java.awt.Color(255, 255, 255));

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel10.setText("Encendido:");

        jRadioButton3.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoDHCP.add(jRadioButton3);
        jRadioButton3.setSelected(true);
        jRadioButton3.setText("Si");

        jRadioButton4.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoDHCP.add(jRadioButton4);
        jRadioButton4.setText("No");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel11.setText("DHCP");

        jLabel12.setText("Gateway por defecto");

        jLabel13.setText("Servidor DNS");

        jLabel14.setText("Dirección IP de inicio");

        jLabel15.setText("Maximo número de usuarios");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(139, 139, 139)
                        .addComponent(jLabel11))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton4)
                            .addComponent(jRadioButton3)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField4))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel12)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel14))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextField3)
                                    .addComponent(jTextField2)
                                    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE))))))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jRadioButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(39, 39, 39)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(66, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("          DHCP          ", jPanel4);

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel16.setText("TFTP");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel17.setText("Encendido:");

        jRadioButton5.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoTFTP.add(jRadioButton5);
        jRadioButton5.setSelected(true);
        jRadioButton5.setText("Si");

        jRadioButton6.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoTFTP.add(jRadioButton6);
        jRadioButton6.setText("No");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Pepe.txt", new Boolean(true)},
                {"Pepe1.exe", new Boolean(true)},
                {"Pepe2.doc", new Boolean(true)},
                {"Pepe3.txt", new Boolean(true)},
                {"Pepe4.bin", new Boolean(true)},
                {"Pepe5.docx", new Boolean(true)},
                {"Pepe6.exe", new Boolean(true)}
            },
            new String [] {
                "Archivo", "Disponible"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jTable1);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(152, 152, 152)
                        .addComponent(jLabel16))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton6)
                            .addComponent(jRadioButton5)))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel16)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jRadioButton5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(91, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(" TFTP", jPanel6);

        jPanel7.setBackground(new java.awt.Color(255, 255, 255));

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel18.setText("TFTP");

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel19.setText("Encendido:");

        jRadioButton7.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoDNS.add(jRadioButton7);
        jRadioButton7.setSelected(true);
        jRadioButton7.setText("Si");

        jRadioButton8.setBackground(new java.awt.Color(255, 255, 255));
        rbgrENcendidoDNS.add(jRadioButton8);
        jRadioButton8.setText("No");

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel20.setText("Nombre dominio");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel21.setText("Dirección IP");

        jButton1.setText("Agregar");

        jTable3.setForeground(new java.awt.Color(255, 255, 0));
        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Nombre Dominio", "Dirección IP"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane4.setViewportView(jTable3);

        jButton2.setText("Remover");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                            .addComponent(jButton1)
                            .addGap(85, 85, 85))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                                    .addGap(142, 142, 142)
                                    .addComponent(jLabel18))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                                    .addGap(8, 8, 8)
                                    .addComponent(jLabel19)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jRadioButton8)
                                        .addComponent(jRadioButton7)))
                                .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel21))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jTextField6)
                                        .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE))))
                            .addContainerGap()))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addComponent(jButton2)
                        .addGap(27, 27, 27))))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel18)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(jRadioButton7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButton8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addContainerGap(14, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("           DNS           ", jPanel7);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(54, Short.MAX_VALUE))
        );

        jTabbedPane1.getAccessibleContext().setAccessibleName("");

        PestañasConfiguraciones.addTab("Servicios", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/servicios16x16.png")), jPanel3); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(PestañasConfiguraciones, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(PestañasConfiguraciones, javax.swing.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE)
                .addGap(23, 23, 23))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void insertarPanel(javax.swing.JPanel p, String panel)
    {
        if(!this.pestaña1)
         {
             this.panelPestaña1.add(p);
             pestañasInterfaces.setTitleAt(0, panel);
             this.pestaña1=true;
             this.btnQuitarInterfazPestaña1.setVisible(true);
         }
         else
         {
             this.panelPestaña2.add(p);
             pestañasInterfaces.setTitleAt(1, panel);
             this.pestaña2=true;
             this.btnQuitarInterfazPestaña2.setVisible(true);
         }
    
    }
    
    private void rbtDCHPMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rbtDCHPMouseClicked
        this.txtGateway.setEnabled(false);
        this.txtServidorDNS.setEnabled(false);
        
        
        if(this.pestaña1 || this.pestaña2) {
            if(this.pestaña1 && this.pestaña2) {//
                this.setAsignacionIPPanel(this.panelPestaña1,AsignacionIP.DCHP);
                this.setAsignacionIPPanel(this.panelPestaña2,AsignacionIP.DCHP);
            } else {
                if(this.pestaña1) {
                    this.setAsignacionIPPanel(this.panelPestaña1,AsignacionIP.DCHP);
                    //this.setAsigancioIPPanel1(AsignacionIP.Static);
                } else {
                    this.setAsignacionIPPanel(this.panelPestaña2,AsignacionIP.DCHP);
                    //this.setAsigancioIPPanel2(AsignacionIP.Static);
                }
            }
        }
        //        if(this.pestaña1 || this.pestaña2)
        //        {
        //            if(this.pestaña1 && this.pestaña2)
        //            {//
        //                this.setAsigancioIPPanel1(AsignacionIP.DCHP);
        //                this.setAsigancioIPPanel2(AsignacionIP.DCHP);
        //            }
        //            else
        //            {
        //                if(this.pestaña1)
        //                {
        //                    this.setAsigancioIPPanel1(AsignacionIP.DCHP);
        //                }
        //                else
        //                {
        //                    this.setAsigancioIPPanel2(AsignacionIP.DCHP);
        //                }
        //            }
        //        }
}//GEN-LAST:event_rbtDCHPMouseClicked


    private void rbtStaticMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rbtStaticMouseClicked
        this.txtGateway.setEnabled(true);
        this.txtServidorDNS.setEnabled(true);
        
        //this.pestaña1 this.pestaña2
        // 0 0 -> 0
        // 0 1 -> 1
        // 1 0 -> 1
        // 1 1 -> 1
        if(this.pestaña1 || this.pestaña2) {
            if(this.pestaña1 && this.pestaña2) {//
                this.setAsignacionIPPanel(this.panelPestaña1,AsignacionIP.Static);
                this.setAsignacionIPPanel(this.panelPestaña2,AsignacionIP.Static);
            } else {
                if(this.pestaña1) {
                    this.setAsignacionIPPanel(this.panelPestaña1,AsignacionIP.Static);
                    //this.setAsigancioIPPanel1(AsignacionIP.Static);
                } else {
                    this.setAsignacionIPPanel(this.panelPestaña2,AsignacionIP.Static);
                    //this.setAsigancioIPPanel2(AsignacionIP.Static);
                }
            }
        }
        //        if(this.pestaña1 || this.pestaña2)
        //        {
        //            if(this.pestaña1 && this.pestaña2)
        //            {//
        //                this.setAsigancioIPPanel1(AsignacionIP.Static);
        //                this.setAsigancioIPPanel2(AsignacionIP.Static);
        //            }
        //            else
        //            {
        //                if(this.pestaña1)
        //                {
        //                    this.setAsigancioIPPanel1(AsignacionIP.Static);
        //                }
        //                else
        //                {
        //                    this.setAsigancioIPPanel2(AsignacionIP.Static);
        //                }
        //            }
        //        }
    }//GEN-LAST:event_rbtStaticMouseClicked

    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
        
        if(!this.pestaña1 || !this.pestaña2) {
            switch(this.cmbIntefaces.getSelectedIndex()) {
                case 0:
                    PanelEthernet pe = new PanelEthernet();
                    pe.setAsignacion(this.getAsignacionIP());
                    pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pe,"Ethernet");
                    break;
                case 1:
                    PanelFastEthernetRJ45 pfe = new PanelFastEthernetRJ45();
                    pfe.setAsignacion(this.getAsignacionIP());
                    pfe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pfe,"Fast Ethernet RJ45");
                    break;
                case 2:
                    PanelFastEthernetFibra pfef = new PanelFastEthernetFibra();
                    pfef.setAsignacion(this.getAsignacionIP());
                    pfef.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pfef,"Fast Ethernet Fibra Óptica");
                    break;
                case 3:
                    PanelGigabitRJ45 pg = new PanelGigabitRJ45();
                    pg.setAsignacion(this.getAsignacionIP());
                    pg.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pg,"Gigabit RJ45");
                    break;
                case 4:
                    PanelGigabitFibra pgf = new PanelGigabitFibra();
                    pgf.setAsignacion(this.getAsignacionIP());
                    pgf.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pgf,"Gigabit Fibra Óptica");
                    break;
                case 5:
                    PanelModemPC pm = new PanelModemPC();
                    //pm.setAsginarIP(this.getAsignacionIP());
                    pm.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pm,"Modem");
                    break;
                case 6:
                    PanelSerial ps = new PanelSerial();
                    ps.setAsignacion(this.getAsignacionIP());
                    ps.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(ps,"Serial");
                    break;
                case 7:
                    PanelWireless pw = new PanelWireless();
                    pw.setAsignacionIP(this.getAsignacionIP());
                    pw.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pw,"Wireless");
                    break;
            }
        } else {
            VentanaDeError.mostrarDialog("No se puede agregar interfaz", "             La PC solo acepta 2 Interfaces de coneccion.\nPara agregar una nueva debe quitar alguna de las interfaces actuales", 0);
        }
}//GEN-LAST:event_btnAgregarActionPerformed
  private void insertarPanelPosicion(javax.swing.JPanel p, String panel, int orden)
    {
        switch(orden)
        {
            case 0:
                  this.panelPestaña1.add(p);
                  pestañasInterfaces.setTitleAt(0, panel);
                  this.pestaña1=true;
                  this.btnQuitarInterfazPestaña1.setVisible(true);
                break;
            case 1:
                 this.panelPestaña2.add(p);
                 pestañasInterfaces.setTitleAt(1, panel);
                 this.pestaña2=true;
                 this.btnQuitarInterfazPestaña2.setVisible(true);
                break;
        }



    }

   public void agregarInterfaces(ArrayList listaInterfaces)
    {
        int contador= 0;
        int val=0;
        Iterator iter= listaInterfaces.iterator();
        while(iter.hasNext())
        {
           InterfaceDeConeccion i= (InterfaceDeConeccion)iter.next();

           if(i instanceof Ethernet)
           {
                     PanelEthernet pe = new PanelEthernet();
                     pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Ethernet",contador);
                     pe.setCampos((Ethernet)i);
                     contador++;

           }
          if(i instanceof FibraOpticaFastEthernet)
          {
                     PanelFastEthernetFibra pe = new PanelFastEthernetFibra();
                     pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Fast Ethernet Fibra",contador);
                     pe.setCampos((FibraOpticaFastEthernet)i);
                     contador++;

          }
          if(i instanceof FastEthernet)
          {
                     PanelFastEthernetRJ45 pe = new PanelFastEthernetRJ45();
                     pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Fast Ethernet RJ45",contador);
                     pe.setCampos((FastEthernet)i);
                     contador++;

          }
          if(i instanceof RJ45Gigabit)
          {
                     PanelGigabitRJ45 pe = new PanelGigabitRJ45();
                     pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Gigabit RJ45",contador);
                     pe.setCampos((RJ45Gigabit)i);
                     contador++;
          }
          if(i instanceof FibraOpticaGigabit)
          {
                     PanelGigabitFibra pe = new PanelGigabitFibra();
                     pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Gigabit Fibra Óptica",contador);
                     pe.setCampos((FibraOpticaGigabit)i);
                     contador++;
          }
          if(i instanceof InterfazModemPC)
          {
                     PanelModemPC pe = new PanelModemPC();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Modem",contador);
                     pe.setCampos((InterfazModemPC)i);
                     contador++;
          }
          if(i instanceof Serial)
          {
                     PanelSerial pe = new PanelSerial();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Serial",contador);
                     pe.setCampos((Serial)i);
                     contador++;
          }
          if(i instanceof Wireless)
          {
                     PanelWireless pe = new PanelWireless();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Modem",contador);
                     pe.setCampos((Wireless)i);
                     contador++;
          }
        }
    }

    private void btnQuitarInterfazPestaña1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña1ActionPerformed
        
        this.panelPestaña1.remove(this.panelPestaña1.getComponent(1));
        this.pestaña1=false;
        pestañasInterfaces.setTitleAt(0, "Interfaz 1");
        this.btnQuitarInterfazPestaña1.setVisible(false);
}//GEN-LAST:event_btnQuitarInterfazPestaña1ActionPerformed

    private void btnQuitarInterfazPestaña2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña2ActionPerformed
        
        this.panelPestaña2.remove(this.panelPestaña2.getComponent(1));
        this.pestaña2=false;
        pestañasInterfaces.setTitleAt(1, "Interfaz 2");
        this.btnQuitarInterfazPestaña2.setVisible(false);
}//GEN-LAST:event_btnQuitarInterfazPestaña2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane PestañasConfiguraciones;
    private javax.swing.ButtonGroup btgrEncendido;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnQuitarInterfazPestaña1;
    private javax.swing.JButton btnQuitarInterfazPestaña2;
    private javax.swing.JComboBox cmbIntefaces;
    private javax.swing.JComboBox cmbencendido;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JRadioButton jRadioButton8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JPanel panelPestaña1;
    private javax.swing.JPanel panelPestaña2;
    private javax.swing.JTabbedPane pestañasInterfaces;
    private javax.swing.ButtonGroup rbgrENcendidoDHCP;
    private javax.swing.ButtonGroup rbgrENcendidoDNS;
    private javax.swing.ButtonGroup rbgrENcendidoHTTP;
    private javax.swing.ButtonGroup rbgrENcendidoTFTP;
    private javax.swing.ButtonGroup rbgrpAsignacionIP;
    private javax.swing.JRadioButton rbtDCHP;
    private javax.swing.JRadioButton rbtStatic;
    private javax.swing.JTextField txtGateway;
    private javax.swing.JTextField txtNombreAMostrar;
    private javax.swing.JTextField txtServidorDNS;
    // End of variables declaration//GEN-END:variables
private void setAsignacionIPPanel(javax.swing.JPanel p, AsignacionIP ip)
    {
         if(p.getComponent(1) instanceof tsb.UI.Paneles.PC.PanelEthernet)
        {
           PanelEthernet pe = (PanelEthernet)p.getComponent(1);
           pe.setAsignacion(ip);
           return;
        }

        if(p.getComponent(1) instanceof PanelFastEthernetRJ45)
        {
            PanelFastEthernetRJ45 pe = (PanelFastEthernetRJ45)p.getComponent(1);
             pe.setAsignacion(ip);
             return;
        }
        if(p.getComponent(1) instanceof PanelFastEthernetFibra)
        {
            PanelFastEthernetFibra pe = (PanelFastEthernetFibra)p.getComponent(1);
             pe.setAsignacion(ip);
           return;
        }
        if(p.getComponent(1) instanceof PanelGigabitRJ45)
        {
            PanelGigabitRJ45 pe = (PanelGigabitRJ45)p.getComponent(1);
             pe.setAsignacion(ip);
           return;
        }
        if(p.getComponent(1) instanceof PanelGigabitFibra)
        {
            PanelGigabitFibra pe = (PanelGigabitFibra)p.getComponent(1);
            pe.setAsignacion(ip);
            return;
        }
        if(p.getComponent(1) instanceof PanelSerial)
        {
            PanelSerial pe = (PanelSerial)p.getComponent(1);
             pe.setAsignacion(ip);
           return;
        }
        if(p.getComponent(1) instanceof PanelModemPC)
        {
            PanelModemPC pe = (PanelModemPC)p.getComponent(1);
             //pe.setAsginarIP(ip);
           return;
        }
         if(p.getComponent(1) instanceof PanelWireless)
        {
            PanelWireless pe = (PanelWireless)p.getComponent(1);
             pe.setAsignacionIP(ip);
           return;
        }
        
    }

public void setNombreAMostrar(String nombre)
    {
        this.txtNombreAMostrar.setText(nombre);
    }
    
    public String getNombreAMostrar()
    {
        return this.txtNombreAMostrar.getText();
    }
    
    public void setEncendido(boolean encendido)
    {
        if(encendido)
        {
            this.cmbencendido.setSelectedIndex(0);
        }
        else
        {
            this.cmbencendido.setSelectedIndex(1);
        }
    }
    
    public boolean getEncendido()
    {
        if(this.cmbencendido.getSelectedIndex()==0)
            return true;
        else
            return false;
    }
    
    public void setAsignacionIP(AsignacionIP asignacion)
    {
        if(asignacion== AsignacionIP.DCHP)
        {
            this.rbtDCHP.setSelected(true);
        }
        else
        {
            this.rbtStatic.setSelected(true);
        }
    }
    
    public AsignacionIP getAsignacionIP()
    {
        if(this.rbtDCHP.isSelected())
            return AsignacionIP.DCHP;
        else
            return AsignacionIP.Static; 
    }
    
    public void setGateway(IP gw )
    {
        if(gw!=null)
        {
            this.txtGateway.setText(gw.toString());
        }
    }
    
    public IP getGateway()
    {
        IP ip = new IP(this.txtGateway.getText());
        return ip;
    }
    
    public void setServidorDNS(IP dns)
    {
        if(dns!=null)
        {
            this.txtServidorDNS.setText(dns.toString());
        }
    }
    
    public IP getServdorDNS()
    {
        IP dns = new IP(this.txtServidorDNS.getText());
        return dns;
    }
    
    public ArrayList<InterfaceDeConeccion> getInterfaces()
    {
        return this.listaInterfaces;
    }
    
    public InterfaceDeConeccion getInterfaz1()
    {
        if(this.panelPestaña1.getComponent(1) instanceof tsb.UI.Paneles.PC.PanelEthernet)
        {
           PanelEthernet pe = (PanelEthernet)this.panelPestaña1.getComponent(1);
            return pe.getEthernet();
        }
        else
        {
            if(this.panelPestaña1.getComponent(1) instanceof PanelFastEthernetRJ45)
            {
                PanelFastEthernetRJ45 pe = (PanelFastEthernetRJ45)this.panelPestaña1.getComponent(1);
                return pe.getRJ45FastEthernet();
            }
            else
            {
                if(this.panelPestaña1.getComponent(1) instanceof PanelFastEthernetFibra)
                {
                    PanelFastEthernetFibra pe = (PanelFastEthernetFibra)this.panelPestaña1.getComponent(1);
                    return pe.getFibraOpticaFastEthernet();
                }
                else
                {
                    if(this.panelPestaña1.getComponent(1) instanceof PanelGigabitRJ45)
                    {
                        PanelGigabitRJ45 pe = (PanelGigabitRJ45)this.panelPestaña1.getComponent(1);
                        return pe.getFibraOpticaGigabit();
                    }
                    else
                    {
                        if(this.panelPestaña1.getComponent(1) instanceof PanelGigabitFibra)
                        {
                            PanelGigabitFibra pe = (PanelGigabitFibra)this.panelPestaña1.getComponent(1);
                            return pe.getFibraOpticaGigabit();
                        }
                        else
                        {
                            if(this.panelPestaña1.getComponent(1) instanceof PanelModemPC)
                            {
                                PanelModemPC pe = (PanelModemPC)this.panelPestaña1.getComponent(1);
                                return pe.getInterfazModem();
                            }
                            else
                            {
                                if(this.panelPestaña1.getComponent(1) instanceof PanelSerial)
                                {
                                    PanelSerial pe = (PanelSerial)this.panelPestaña1.getComponent(1);
                                    return pe.getSerial();
                                }
                                else
                                {
                                     if(this.panelPestaña1.getComponent(1) instanceof PanelWireless)
                                    {
                                        PanelWireless pe = (PanelWireless)this.panelPestaña1.getComponent(1);
                                        return pe.getWireless();
                                    }
                                }
                                
                            }
                            
                        }
                        
                    }
                    
                }
                
            }
        }
        return null;
    }
 
      public InterfaceDeConeccion getInterfaz2()
    {
        if(this.panelPestaña2.getComponent(1) instanceof tsb.UI.Paneles.PC.PanelEthernet)
        {
           PanelEthernet pe = (PanelEthernet)this.panelPestaña2.getComponent(1);
            return pe.getEthernet();
        }
        else
        {
            if(this.panelPestaña2.getComponent(1) instanceof PanelFastEthernetRJ45)
            {
                PanelFastEthernetRJ45 pe = (PanelFastEthernetRJ45)this.panelPestaña2.getComponent(1);
                return pe.getRJ45FastEthernet();
            }
            else
            {
                if(this.panelPestaña2.getComponent(1) instanceof PanelFastEthernetFibra)
                {
                    PanelFastEthernetFibra pe = (PanelFastEthernetFibra)this.panelPestaña2.getComponent(1);
                    return pe.getFibraOpticaFastEthernet();
                }
                else
                {
                    if(this.panelPestaña2.getComponent(1) instanceof PanelGigabitRJ45)
                    {
                        PanelGigabitRJ45 pe = (PanelGigabitRJ45)this.panelPestaña2.getComponent(1);
                        return pe.getFibraOpticaGigabit();
                    }
                    else
                    {
                        if(this.panelPestaña2.getComponent(1) instanceof PanelGigabitFibra)
                        {
                            PanelGigabitFibra pe = (PanelGigabitFibra)this.panelPestaña2.getComponent(1);
                            return pe.getFibraOpticaGigabit();
                        }
                        else
                        {
                            if(this.panelPestaña2.getComponent(1) instanceof PanelModemPC)
                            {
                                PanelModemPC pe = (PanelModemPC)this.panelPestaña2.getComponent(1);
                                return pe.getInterfazModem();
                            }
                            else
                            {
                                if(this.panelPestaña2.getComponent(1) instanceof PanelSerial)
                                {
                                    PanelSerial pe = (PanelSerial)this.panelPestaña2.getComponent(1);
                                    return pe.getSerial();
                                }
                                else
                                {
                                     if(this.panelPestaña2.getComponent(1) instanceof PanelWireless)
                                    {
                                        PanelWireless pe = (PanelWireless)this.panelPestaña2.getComponent(1);
                                        return pe.getWireless();
                                    }
                                }
                                
                            }
                            
                        }
                        
                    }
                    
                }
                
            }
        }
        return null;
    }

       class ComboBoxRenderer extends JLabel
                           implements ListCellRenderer {
        private Font uhOhFont;

        public ComboBoxRenderer() {
            setOpaque(true);
            setHorizontalAlignment(CENTER);
            setVerticalAlignment(CENTER);
        }

        /*
         * This method finds the image and text corresponding
         * to the selected value and returns the label, set up
         * to display the text and image.
         */
        public Component getListCellRendererComponent(
                                           JList list,
                                           Object value,
                                           int index,
                                           boolean isSelected,
                                           boolean cellHasFocus) {
            //Get the selected index. (The index param isn't
            //always valid, so just use the value.)
            int selectedIndex = ((Integer)value).intValue();

            if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
            } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
            }

            //Set the icon and text.  If icon was null, say so.
            ImageIcon icon = images[selectedIndex];
            String pet = opciones[selectedIndex];
            setIcon(icon);
            if (icon != null) {
                setText(pet);
                setFont(list.getFont());
            } else {
                setUhOhText(pet + " (no image available)",
                            list.getFont());
            }

            return this;
        }

        //Set the font and text when no image was found.
        protected void setUhOhText(String uhOhText, Font normalFont) {
            if (uhOhFont == null) { //lazily create this font
                uhOhFont = normalFont.deriveFont(Font.ITALIC);
            }
            setFont(uhOhFont);
            setText(uhOhText);
        }
    }


}
